package remote.containers
{
	import remote.geom.Size;
	import remote.layouts.TileLayout;
	
	/**
	 * 平铺布局容器，无外观
	 * @author 银魂飞雪
	 * @createDate 2011-3-8
	 */
	public class TileGroup extends Group
	{
		public function TileGroup()
		{
			super();
		}
		/**
		 * @inheritDoc 
		 * 
		 */	
		override public function updateSize():void
		{
			var oldSize:Size = new Size(width, height);
			super.updateSize();
			if(!oldSize.equal(new Size(width, height)))		//如果中间对齐，或者右对齐，则尺寸变化，需要更新布局
				this.updateLayout();
		}
		/**
		 * @inheritDoc 
		 * 
		 */	
		override protected function createLayout():void
		{
			_layout = new TileLayout(this);
		}
		
		/**
		 * 行数
		 * @return 行数 
		 * 
		 */		
		public function get rowCount():int
		{
			return (_layout as TileLayout).rowCount;
		}
		
		/**
		 * 列数 
		 * @return 列数 
		 * 
		 */		
		public function get colCount():int
		{
			return (_layout as TileLayout).colCount;
		}
		
		public function set colCount(value:int):void
		{
			(_layout as TileLayout).colCount = value;
			this.updateSize();
		}
		
		/**
		 * 竖直方向对齐方式 
		 * @param value
		 * 
		 */		
		public function set valgin(value:String):void
		{
			(_layout as TileLayout).valgin = value;
			this.updateSize();
		}
		
		public function get valgin():String
		{
			return (_layout as TileLayout).valgin;
		}
		
		/**
		 * 水平方向对齐方式
		 * @param value
		 * 
		 */		
		public function set halgin(value:String):void
		{
			(_layout as TileLayout).halgin = value;
			this.updateSize();
		}
		
		public function get halgin():String
		{
			return (_layout as TileLayout).halgin;
		}
		/**
		 * 水平方向各项间隔
		 * @param value
		 * 
		 */		
		public function set hgap(value:Number):void
		{
			(_layout as TileLayout).hgap = value;
			this.updateSize();
		}
		
		public function get hgap():Number
		{
			return (_layout as TileLayout).hgap;
		}
		/**
		 * 竖直方向各项间隔
		 * @param value
		 * 
		 */		
		public function set vgap(value:Number):void
		{
			(_layout as TileLayout).vgap = value;
			this.updateSize();
		}
		
		public function get vgap():Number
		{
			return (_layout as TileLayout).vgap;
		}
		/**
		 * 列宽
		 * @param value
		 * 
		 */		
		public function set colWidth(value:Number):void
		{
			(_layout as TileLayout).colWidth = value;
			updateSize();
		}
		
		public function get colWidth():Number
		{
			return (_layout as TileLayout).colWidth;
		}
		/**
		 * 行高
		 * @param value
		 * 
		 */		
		public function set rowHeight(value:Number):void
		{
			(_layout as TileLayout).rowHeight = value;
			updateSize();
		}
		
		public function get rowHeight():Number
		{
			return (_layout as TileLayout).rowHeight;
		}
	}
}